import request from '@/utils/request'

// 查询经销商订单列表
export function listDistributorOrders(query) {
  return request({
    url: '/DistributorOrders/DistributorOrders/list',
    method: 'get',
    params: query
  })
}

// 查询经销商订单详细
export function getDistributorOrders(orderCode) {
  return request({
    url: '/DistributorOrders/DistributorOrders/' + orderCode,
    method: 'get'
  })
}

// 新增经销商订单
export function addDistributorOrders(data) {
  return request({
    url: '/DistributorOrders/DistributorOrders',
    method: 'post',
    data: data
  })
}

// 修改经销商订单
export function updateDistributorOrders(data) {
  return request({
    url: '/DistributorOrders/DistributorOrders',
    method: 'put',
    data: data
  })
}

// 删除经销商订单
export function delDistributorOrders(orderCode) {
  return request({
    url: '/DistributorOrders/DistributorOrders/' + orderCode,
    method: 'delete'
  })
}


// 修改订单状态
export function updateOrderStatus(orderCode, status) {
  return request({
    url: `/DistributorOrders/DistributorOrders/${orderCode}/status`,
    method: 'put',
    data: { status }
  });
}


// 创建结算单
export function createSettlement(data) {
  return request({
    url: '/record/record',
    method: 'post',
    data: data
  });
}